From: Claudio Cambra Date: Tue, 29 Apr 2025 04:51:13 +0000 (+0800) Subject: feat(mac-crafter): Add ability to codesign with an entitlements file X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1^2~13^2~1^2~17^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=67d99a46d369a0d8d9684eda91760f1de5244dc5;p=nextcloud-desktop.git feat(mac-crafter): Add ability to codesign with an entitlements file Signed-off-by: Claudio Cambra --- diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index 927133133..cd6046701 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -107,7 +107,9 @@ func saveCodesignEntitlements(target: String, path: String) throws { } func codesignClientAppBundle( - at clientAppDir: String, withCodeSignIdentity codeSignIdentity: String + at clientAppDir: String, + withCodeSignIdentity codeSignIdentity: String, + usingEntitlements entitlementsPath: String? = nil ) throws { print("Code-signing Nextcloud Desktop Client libraries, frameworks and plugins...") @@ -197,5 +199,13 @@ func codesignClientAppBundle( let mainExecutableName = String(appName.dropLast(".app".count)) let mainExecutablePath = "\(binariesDir)/\(mainExecutableName)" try recursivelyCodesign(path: binariesDir, identity: codeSignIdentity, skip: [mainExecutablePath]) - try codesign(identity: codeSignIdentity, path: mainExecutablePath) + + var mainExecutableCodesignOptions = defaultCodesignOptions + if let entitlementsPath { + mainExecutableCodesignOptions = + "--timestamp --force --verbose=4 --options runtime --entitlements \"\(entitlementsPath)\"" + } + try codesign( + identity: codeSignIdentity, path: mainExecutablePath, options: mainExecutableCodesignOptions + ) }